package com.jt.www.hadoopcould.service.impl;

import com.jt.www.hadoopcould.dao.UserDao;
import com.jt.www.hadoopcould.model.user;
import com.jt.www.hadoopcould.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.NoSuchElementException;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
   private UserDao userDao;

    @Override
    public user save(user u) {
        return userDao.save(u);
    }

    @Override
    public user findById(String id) {
       user user=null;
        try{
            user=userDao.findById(id).get();
        }catch(NoSuchElementException e){
            System.out.println("此账号不存在可以注册");
        }
        return user;
    }
}
